#pragma once

#include "OnDemandServerMediaSubsession.hh"

class IPCameraWAVAudioServerMediaSubsession: public OnDemandServerMediaSubsession{
public:
	static IPCameraWAVAudioServerMediaSubsession*
		createNew(UsageEnvironment& env, Boolean reuseFirstSource,
		Boolean convertToULaw = False);
	// If "convertToULaw" is True, 16-bit audio streams are converted to
	// 8-bit u-law audio prior to streaming.

protected:
	IPCameraWAVAudioServerMediaSubsession(UsageEnvironment& env, 
		Boolean reuseFirstSource, Boolean convertToULaw);
	// called only by createNew();
	virtual ~IPCameraWAVAudioServerMediaSubsession();

protected: // redefined virtual functions
	virtual void seekStreamSource(FramedSource* inputSource, double seekNPT);
	virtual void setStreamSourceScale(FramedSource* inputSource, float scale);
	virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
		unsigned& estBitrate);
	virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock,
		unsigned char rtpPayloadTypeIfDynamic,
		FramedSource* inputSource);
	virtual void testScaleFactor(float& scale);
	virtual float duration() const;

protected:
	Boolean fConvertToULaw;

	// The following parameters of the input stream are set after
	// "createNewStreamSource" is called:
	unsigned char fAudioFormat;
	unsigned char fBitsPerSample;
	unsigned fSamplingFrequency;
	unsigned fNumChannels;
	float fDuration;

public:
	char	SDPLines[1024];
	int		int_stream_id;
	void*	ptr_frame_buffer;
};


